﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TWiStEr.Math;
using Phys.Model.Affectors;

namespace Phys.Model {
	public abstract class AObject : IObject {
		public AObject() {
			Affectors = new List<IAffector>();
		}
		public virtual string Name { get; set; }
		public virtual double Mass { get; set; }
		public virtual Vector Position { get; set; }
		public virtual Vector Velocity { get; set; }
		public virtual Vector Acceleration { get { return Forces / Mass; } set { Forces = value * Mass; } }
		public virtual Vector Forces { get; set; }
		public virtual Vector Momentum { get { return Mass * Velocity; } set { Velocity = value / Mass; } }
		public virtual IList<IAffector> Affectors { get; private set; }
		public virtual WorldObject World { get; set; }

		public override string ToString() {
			return string.Format("{0} ({1})", Name, GetType().Name.Remove(GetType().Name.IndexOf("Object")));
		}
	}
}
